<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
	
<%@ include file="/WEB-INF/views/shared/taglib.jsp"%>

<div class="row">
	<div class="col-md-12 col-sm-12 col-lg-12 col-xs-12 text-right">
		<t:roleButton />
	</div>
</div>
<div class="modal fade" id="grounding" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">提示消息</h4>
            </div>
            <div class="modal-body" style="color:blue">确定要执行上架操作吗？亲</div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" id="sureShelf" class="btn btn-primary">确定</button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="ungrounding" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">提示消息</h4>
            </div>
            <div class="modal-body" style="color:blue">确定要执行下架操作吗？亲</div>
            <div class="modal-footer">
                <button type="button"  class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" id="sure" class="btn btn-primary">确定</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
function addData(){
	top.openModal("/admin/insu/insurance/insuranceDetailed","insurance_form","保险信息-添加",800,446);
}
function editData(){
	var id=getKeyId();
	if(isEditor(id)){
		top.openModal("/admin/insu/insurance/insuranceDetailed?key="+id,"insurance_form","保险信息-修改",800,446);
	}
}
function selData(){
	var id=getKeyId();
	if(isEditor(id)){
		top.openModal("/admin/insu/insurance/insuranceDetailed?key="+id+"&mode=3","insurance_form","保险信息-查看",800,446);	
	}
}
function deleteData(){
	var id=getKeyId();
	if(isEditor(id)){
		var url=$.getVirtualPath()+"/admin/insu/insurance/delete?key="+id;
		deleteDataEx(url,function(data){
			if(data.resultType=="success"){
				formSubmit();
			}
		})		
		
	}
}

//上架
function shelf(){
	$("#grounding").modal("show");
}
$("#sureShelf").on("click",function(){
	$("#grounding").modal("hide");
	var insuranceSearch=$("#insuranceSearch").serialize();
 	var url=$.getVirtualPath()+"/admin/insu/insurance/shelf?insuranceSearch"+insuranceSearch;
	var res = $.getJsonPost(url);
	if(res == 'success'){
		formSubmit();
		alert("上架成功");
	}else{
		alert("上架失败");
	}
})

//下架
function undercarriage(){
	$("#ungrounding").modal("show");
}
$("#sure").on("click",function(){
	$("#ungrounding").modal("hide");
	var formData=$("#insuranceSearch").serialize();
	var url=$.getVirtualPath()+"/admin/insu/insurance/undercarriage?formData"+formData;
	var res = $.getJsonPost(url);
	if(res == 'success'){
		formSubmit();
		alert("下架成功");
	}else{
		alert("下架失败");
	}
});
</script>